import request from './request'

//二维码登录
export const key = () => {
    return request({ url: `/login/qr/key?timestamp=${new Date().getTime()}`, method: 'GET' })
  }
  
  export const baseimg = (key) => {
    return request({ url: `/login/qr/create?key=${key}&qrimg=true&timestamp=${new Date().getTime()}`, method: 'GET' })
  }
  
  
  export const cookie = (key) => {
    return request({ url: `/login/qr/check?key=${key}&timestamp=${new Date().getTime()}`, method: 'GET' })
  }
  
  //验证码登录
  export const login = (tel,captcha , timestamp) => {
    return request({ url: `/login/cellphone?phone=${tel}&captcha=${captcha}$timestamp=${timestamp}`, method: 'GET' })
  }
  //获取验证码
  export const getcaptcha = (tel) => {
    return request({ url: `/captcha/sent?phone=${tel}`, method: 'GET' })
  }
  
  //验证码验证
  export const verifycaptcha = (tel,captcha) => {
    return request({ url: `/captcha/verify?phone=${tel}&captcha=${captcha}`, method: 'GET' })
  }

  export const userloginnewsApi = () => {
    return request({ url: `/user/account?cookie=${localStorage.getItem('cookie')}`, method: 'GET' })
  }

  export const userdetailApi = () => {
    return request({ url:`/user/account`, method: 'GET' })
  }

  export const loginRefresh = () => {
    return request({ url: `/login/refresh`, method: 'GET' })
  }


//获取登录状态
  export const loginstatelApi = () => {
    return request({ url: `/login/status?cookie=${localStorage.getItem('cookie')}`, method: 'GET' })
  }

//退出登录

export const logoutApi = () => {
  return request({ url: `/logout`, method: 'GET' })
}

//
export const usersheetApi = (uid) => {
  return request({ url: `/user/playlist?uid=${uid}`, method: 'GET' })
}